#define  _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

//int main()
//{
//	long a = 1;
//	printf("%d", a);
//	return 0;
//}

int* productExceptSelf(int* nums, int numsSize, int* returnSize) {
    int* arr = (int*)malloc(sizeof(int) * numsSize);
    int left[numsSize];
    int right[numsSize];
    left[0] = 1,
        right[numsSize - 1] = 1;
    for (int i = 1; i < numsSize; i++) // 1 2 3
    {
        left[i] = left[i - 1] * nums[i - 1]; // 0 1 2
    }
    for (int i = numsSize - 1 - 1; i >= 0; i--)
    {
        right[i] = right[i + 1] * nums[i + 1]; // 3 2 1
    }
    for (int i = 0; i < numsSize; i++)
    {
        arr[i] = left[i] * right[i];//0     3
    }
    *returnSize = numsSize;
    return arr;
}